var previewContainer = document.getElementById("previewContainer");
var addPicImg = document.getElementById("addPicImg");
document.getElementById("fileInput").addEventListener("change", function() {
//   previewContainer.innerHTML = ""; // 清空预览区域
  var files = this.files;
  for (var i = 0; i < files.length; i++) {
    var fileReader = new FileReader();
    fileReader.readAsDataURL(files[i]);

    fileReader.onload = function(e) {
      var imgSrc = e.target.result;

      // 创建img标签并添加到预览区域
      var img = document.createElement("img");
      img.src = imgSrc;
      img.width = 100;
      img.height = 100;
      img.style.margin = "5px";
      previewContainer.appendChild(img);
    };
  }
});


addPicImg.addEventListener("click", function() {
    document.getElementById("fileInput").click();
});


$(".to-back").on("click",function(e){
  window.location.location="index.html";
  $(location).attr('href','http://127.0.0.1:5500/html/index.html');
});


$(".submit-button").on("click",function(e){
  window.location.location="index.html";
  $(location).attr('href','http://127.0.0.1:5500/html/index.html');
});